Skip to content

Comments

[Infra] - ci/cd, ec2, alb, mysql, logging, monitoring, nginx#5

Merged
kargowild merged 14 commits intodevelopfrom
feature/#2
Jul 24, 2025
Merged

[Infra] - ci/cd, ec2, alb, mysql, logging, monitoring, nginx#5
kargowild merged 14 commits intodevelopfrom
feature/#2

Conversation

@kargowild
Copy link
Contributor

@kargowild kargowild commented Jul 19, 2025

  • prod ec2 2대 배포 완료
  • prod용 alb 구성 완료 (health check에서 오류나는 중)
    • 멘토링 받은 내용대로 API Gateway로 전환과정 필요
  • prod용 mysql ec2 실행 완료
    • mysql 컨테이너 띄우기 까지만 완료
  • nginx
    • dev용 nginx는 kokomen-backend 레포지토리에서 nginx.conf 변경만 진행 완료 -> 머지 후 nginx 컨테이너 재시작 필요
  • ci/cd
    1. dev internal ci/cd는 정상 작동하는 것 확인함
    2. dev api ci/cd도 정상 작동하는지 확인하려면 api 폴더 쪽에 변경사항 있는 PR 올려봐야 함
    3. internal, api 모두 변경사항이 있을 경우 ci/cd가 둘 다 잘 도는지도 확인 필요 (2번 확인되면 아마 잘 돌 듯)
  • logging, prod용 ci/cd, prod용 nginx 설정은 새로운 이슈에서 진행 예정

@kargowild kargowild self-assigned this Jul 19, 2025
@kargowild kargowild linked an issue Jul 19, 2025 that may be closed by this pull request
@github-actions
Copy link

github-actions bot commented Jul 19, 2025

Test Results

1 tests   1 ✅  0s ⏱️
1 suites  0 💤
1 files    0 ❌

Results for commit 7615f0e.

♻️ This comment has been updated with latest results.

Copy link
Contributor Author

@kargowild kargowild left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+) file changed에 없어서 코멘트를 못 달았는데,

internal의 application.yml 에서 #local profile에 해당하는 내용은 어떤 역할인가요? 현재 필요없는 상태가 맞을까요?!

Comment on lines +7 to +19
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
api_changed: ${{ steps.filter.outputs.api }}
steps:
- uses: actions/checkout@v4
- id: filter
uses: dorny/paths-filter@v3
with:
filters: |
api:
- 'api/**'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

internal, api용 브랜치를 나누지 않기로 했으니, 이전에 논의했던 대로 파일 변경이 생긴 경우에만 trigger되도록 cd 파일을 분리했습니다.

찾아보니까 특정 폴더에 파일 변경이 생겼는지 알아보기 위해 dorny/paths-filter라는 액션을 많이 사용하길래 적용해봤습니다!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 확정이었을까요??

전에 말씀드린 것처럼 dev -> prod 로 merge 될때 각 모듈이 따로 배포 될 수 있도록 조절이 가능한 것일까요?

Copy link
Contributor Author

@kargowild kargowild Jul 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 그 부분을 놓치고 구현했네요 😅
예를 들어 develop에는 api, internal 변경사항이 모두 생겼는데 api만 배포하고 싶은 상황 말씀하시는 거 맞을까요?
저번에 질문 드리다가 정리가 안됐었는데, 이 부분을 멘토님께 정리해서 질문드려봐야 할 것 같네요!!

이거 혹시 좀 더 구체적인 상황을 예시들어주실 수 있나요? 제가 좀 헷갈려서요 ㅠ

Comment on lines +10 to +11
outputs:
api_changed: ${{ steps.filter.outputs.api }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이게 변수처럼 사용돼서 아래 build-api를 돌릴지 말지 결정하게 됩니다.

Comment on lines +50 to +51
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이런 시크릿변수들 너무 공용으로 사용하니까 레포지토리마다 선언하는게 아니고 Organization secrets로 설정했습니다!
아직 기존 kokomen-backend에서는 Repository secrets를 사용하고 있는데, 겹치는 변수들은 삭제해도 될 것 같아요.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네네 좋습니다!! 이슈, PR 템플릿도 organization 기준으로 설정 가능하던데, 고것도 한번 참고해서 적용하면 좋을 거 같네요!

Comment on lines +7 to +8
expose:
- 8080
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

모든 컨테이너에서 expose 적극 활용했습니다. 모듈마다 포트번호 따로 지정해주는게 번거로울 것 같아서요!

restart: always
environment:
TZ: Asia/Seoul
MYSQL_USER: ${SPRING_DATASOURCE_USERNAME_DEV}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

헷갈리는게 ${SPRING_DATASOURCE_USERNAME_DEV} 이거 우리 kokomen으로 쓰고 있었나요 root로 쓰고 있었나요? 일단 root로 해서 잘 돌아가는 것까진 확인했습니다

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 잘 기억이 안나네요 ㅎ..

networks:
- dev-kokomen-net

notification-mysql-dev-exporter:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prometheus는 kokomen-backend의 docker compose에서 돌리고 있어서, 거기서 위 exporter도 바라보도록 수정해줬습니다. (PR만 올라간 상태)

도커네트워크를 싹다 연결해놔서 아마 잘 찾아갈 것 같습니다!

run: |
export HOSTNAME=$(hostname)
cd kokomen-notification/docker/dev
sudo -E docker compose -f docker-compose-dev.yml up -d kokomen-notification-dev-internal
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-d 뒤에 애플리케이션 컨테이너만 실행하도록 구체적으로 명시했습니다

activate:
on-profile: dev
datasource:
url: jdbc:mysql://kokomen-notification-mysql-dev:3306/kokomen-notification-dev
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이거 이렇게 컨테이너 이름으로 박아놔도 되겠죠?
kokomen-backend에서는 이걸 왜 시크릿으로 관리했었는지 기억이 잘 안나네요

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네 dev라 괜찮아 보입니다 ㅎㅎ

Copy link
Member

@nak-honest nak-honest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

브랜치 쪼개는 쪽 이야기 한번 더 해보고 merge 시키면 좋을 것 같아 일단 comment로 남겨드려요!
고생 많으셨습니다~!!

Comment on lines +7 to +19
jobs:
detect-changes:
runs-on: ubuntu-latest
outputs:
api_changed: ${{ steps.filter.outputs.api }}
steps:
- uses: actions/checkout@v4
- id: filter
uses: dorny/paths-filter@v3
with:
filters: |
api:
- 'api/**'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 확정이었을까요??

전에 말씀드린 것처럼 dev -> prod 로 merge 될때 각 모듈이 따로 배포 될 수 있도록 조절이 가능한 것일까요?

Comment on lines +50 to +51
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네네 좋습니다!! 이슈, PR 템플릿도 organization 기준으로 설정 가능하던데, 고것도 한번 참고해서 적용하면 좋을 거 같네요!

if: always()
with:
report_paths: ${{ github.workspace }}/api/build/test-results/**/*.xml
token: ${{ github.token }} No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

개행문자 추가해주시면 감사하겠습니닷!

restart: always
environment:
TZ: Asia/Seoul
MYSQL_USER: ${SPRING_DATASOURCE_USERNAME_DEV}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 잘 기억이 안나네요 ㅎ..

activate:
on-profile: dev
datasource:
url: jdbc:mysql://kokomen-notification-mysql-dev:3306/kokomen-notification-dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네 dev라 괜찮아 보입니다 ㅎㅎ

@nak-honest
Copy link
Member

internal의 application.yml 에서 #local profile에 해당하는 내용은 어떤 역할인가요? 현재 필요없는 상태가 맞을까요?!

현재는 내용이 비어있고 domain 모듈의 로컬 프로파일을 가져오고 있어서 아무 역할을 안하고 있습니다! 처음에는 내용이 따로 있다보니 따라온 거였어요!
삭제하셔도 냅두셔도 무방합니다

@kargowild kargowild merged commit 8bffcc1 into develop Jul 24, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Infra] - ci/cd, ec2, alb, mysql, logging, monitoring, nginx

2 participants